#include<bits/stdc++.h>
#define XH(i,a,b) for(int i=a;i<b;++i)
#define XXH(i,a,b) for(int i=a-1;i>=b;--i)
#define LL long long
using namespace std;
int tmpINT; string tmpSTRING; char tmpCHAR; double tmpDOUBLE; LL tmpLONGLONG;

int main(){
    int n;scanf("%d", &n);
    int ans = 0;
    vector< vector<int> >visit(110, vector<int>(110) );
    for (int i = 0 ; i < n ; ++i){
        int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2;
        ans += (x2-x1)*(y2-y1);
        XH( x , x1 , x2 ){
            XH( y , y1 , y2 ){
                if( visit[x][y] ){
                    --ans;
                    continue;
                }
                visit[x][y] = 1;
            }
        }
    }
    printf("%d\n", ans);

    return 0;
}
